
import com.nokia.mid.ui.orientation.Orientation;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author mluz
 */
public class MyCanvas extends Canvas{
    
    public boolean isPressed = false;
    AshaNXTControl midlet;
    
    public MyCanvas(){
        setFullScreenMode(true);
        
    }

    protected void paint(Graphics g) {
        Orientation.setAppOrientation(Orientation.ORIENTATION_LANDSCAPE);
        g.setColor(0, 128, 0);
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(0, 0, 0);
        g.drawString("Tap the screen to move on", getWidth()/2, 15, Graphics.HCENTER | Graphics.TOP);
        g.drawString("Rotate the asha to turn left/right", getWidth()/2, 35, Graphics.HCENTER | Graphics.TOP);
        g.setColor(128, 0, 0);
        g.fillRect(getWidth()-50, getHeight()-30, 50, 30);
        g.setColor(0, 0, 0);
        g.drawString("Exit", getWidth()-25, getHeight()-28, Graphics.HCENTER | Graphics.TOP);
    }
    
    protected void pointerPressed(int x, int y){
        isPressed = true;
    }

    protected void pointerReleased(int x, int y){
        if (x > getWidth()-50 && y > getHeight()-30) {
            AshaNXTControl.instance.notifyDestroyed();
        }
        isPressed = false;
    }
    
}
